clear all
set more off
capture log close
cap cd "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Data"
pause on
log using "Analysis zsm2020reserving.log", replace
use "Treaty Obligations and Reservations zsm2020reserving.dta", replace





***
* Setting Global Controls
***


* Provisions
global provisions demanding nonderog_prov 
global provisions2 demanding_index nonderog_prov 

* Treaties
global treaties physinteg group_specific 

* Domestic institutions
global institutions com_only avg_v2juhcind treateq_sup avg_nhri_powers avg_polity2 avg_fariss_latentmean

* Economic factors
global econ avg_ln_gdp_percap avg_ln_pop_total

* Treaty dummies
global dummies tr_cat  tr_geno tr_ccpr  tr_ced tr_cescr
*minus tr_crmw tr_cedaw tr_cerd tr_crc tr_crpd





***
* Main Regression Model
***

* Table 2: Treaty Reservations at the Provision Level

eststo clear
eststo A: logit reservation_5Y $provisions, vce(cluster country_treaty)
eststo B: logit reservation_5Y $provisions $institutions, vce(cluster country_treaty)
eststo C: logit reservation_5Y $provisions $institutions $econ, vce(cluster country_treaty)
eststo D: logit reservation_5Y $provisions $institutions $econ $dummies, vce(cluster country_treaty)
esttab A B C D using demanding.csv, replace unstack label b(2) se(2) nomtitles indicate("Treaty Dummies = tr_*")/*
*/ title("Treaty Reservations at the Provision Level") addnotes("All models report clustered standard errors by country-treaty.") star(+ 0.10 * 0.05 ** .01) 

logit reservation_5Y $provisions $institutions $econ, vce(cluster country_treaty)
margins, at(demanding=(0 1))
margins, at(com_only=(0 1))





***
* Supplementary Regression Models
***


* Table A1: Treaty Reservations at the Provision Level, using Individual Components of Demanding Provisions */

eststo E: logit reservation_5Y $provisions $institutions $econ, vce(cluster country_treaty)
eststo F: logit reservation_5Y strong nonderog_prov $institutions $econ, vce(cluster country_treaty)
eststo G: logit reservation_5Y precise nonderog_prov $institutions $econ, vce(cluster country_treaty)
eststo H: logit reservation_5Y dom_action nonderog_prov $institutions $econ, vce(cluster country_treaty)
eststo I: logit reservation_5Y strong precise dom_action nonderog_prov $institutions $econ, vce(cluster country_treaty)
esttab E F G H I using demanding_indiv.csv, replace unstack label b(2) se(2) nomtitles/*
*/ title("Treaty Reservations at the Provision Level, using Individual Components of Demanding Provisions")/*
*/ addnotes("All models report clustered standard errors by country-treaty.") star(+ 0.10 * 0.05 ** .01) 



* Table A2: Treaty Reservations at the Provision Level, using an Index of Demanding Provisions

eststo J: logit reservation_5Y $provisions2, vce(cluster country_treaty)
eststo K: logit reservation_5Y $provisions2 $institutions, vce(cluster country_treaty)
eststo L: logit reservation_5Y $provisions2 $institutions $econ, vce(cluster country_treaty)
eststo M: logit reservation_5Y $provisions2 $institutions $econ $dummies, vce(cluster country_treaty)
esttab J K L M using demanding_index.csv, replace unstack label b(2) se(2) nomtitles indicate("Treaty Dummies = tr_*")/*
*/ title("Treaty Reservations at the Provision Level, using an Index of Demanding Provisions")/*
*/ addnotes("All models report clustered standard errors by country-treaty.") star(+ 0.10 * 0.05 ** .01) 



* Table A3: Treaty Reservations at the Provision Level (with controls for Other Countries’ Prior Reservations)

eststo AA: logit reservation_5Y $provisions reserv_prior, vce(cluster country_treaty)
eststo BA: logit reservation_5Y $provisions reserv_prior $institutions, vce(cluster country_treaty)
eststo CA: logit reservation_5Y $provisions reserv_prior $institutions $econ, vce(cluster country_treaty)
eststo DA: logit reservation_5Y $provisions reserv_prior $institutions $econ $dummies, vce(cluster country_treaty)
esttab AA BA CA DA using demanding_prior.csv, replace unstack label b(2) se(2) nomtitles indicate("Treaty Dummies = tr_*")/*
*/ title("Treaty Reservations at the Provision Level (with controls for Other Countries’ Prior Reservations)")/*
*/ addnotes("All models report clustered standard errors by country-treaty.") star(+ 0.10 * 0.05 ** .01) 



* Tables A4-A7 >> See end of .do file



* Table A8: Treaty Reservations at the Provision Level (SE clustered by country)

eststo N: logit reservation_5Y $provisions, vce(cluster country)
eststo O: logit reservation_5Y $provisions $institutions, vce(cluster cow_id)
eststo P: logit reservation_5Y $provisions $institutions $econ, vce(cluster cow_id)
eststo Q: logit reservation_5Y $provisions $institutions $econ $dummies, vce(cluster cow_id)
esttab N O P Q using demanding_SEcountry.csv, replace unstack label b(2) se(2) nomtitles indicate("Treaty Dummies = tr_*")/*
*/ title("Treaty Reservations at the Provision Level (SE clustered by country)")/*
*/ addnotes("All models report clustered standard errors by country.") star(+ 0.10 * 0.05 ** .01) 



* Table A9: Treaty Reservations at the Provision Level (SE clustered by treaty)

eststo R: logit reservation_5Y $provisions, vce(cluster treaty_id)
eststo S: logit reservation_5Y $provisions $institutions, vce(cluster treaty_id)
eststo T: logit reservation_5Y $provisions $institutions $econ, vce(cluster treaty_id)
eststo U: logit reservation_5Y $provisions $institutions $econ $dummies, vce(cluster treaty_id)
esttab R S T U using demanding_SEtreaty.csv, replace unstack label b(2) se(2) nomtitles indicate("Treaty Dummies = tr_*")/*
*/ title("Treaty Reservations at the Provision Level (SE clustered by treaty")/*
*/ addnotes("All models report clustered standard errors by treaty.") star(+ 0.10 * 0.05 ** .01) 



* Table A10: Treaty Reservations at the Provision Level (multiway clustering)

eststo V: vcemway logit reservation_5Y $provisions, cluster(cow_id country_treaty treaty_id provision_id)
eststo W: vcemway logit reservation_5Y $provisions $institutions, cluster(cow_id country_treaty treaty_id provision_id)
eststo X: vcemway logit reservation_5Y $provisions $institutions $econ, cluster(cow_id country_treaty treaty_id provision_id)
eststo Y: vcemway logit reservation_5Y $provisions $institutions $econ $dummies, cluster(cow_id country_treaty treaty_id provision_id)
esttab V W X Y using demanding_SEmultiway.csv,  replace unstack label b(2) se(2) nomtitles indicate("Treaty Dummies = tr_*")/*
*/title("Treaty Reservations at the Provision Level (multiway clustering)")/*
*/ addnotes("All models report clustered standard errors by country, country-treaty, treaty, and provision.") star(+ 0.10 * 0.05 ** .01) 





***
* Coefficient plots
***


* Figure 7: Predicted Effect of Variables on the Likelihood of Reservation, with 95 percent CIs

eststo plot1: sem (reservation_5Y <- $provisions $institutions $econ, vce(cluster country_treaty))
coefplot, drop(_cons) xline(0) xlabel(, nogrid) ylabel(, nogrid) b(b_std) v(V_std) xtitle(Standardized Coefficients)  level(95) 
graph export "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Figures/Figure 7.eps", replace



* Figure A2: Predicted Effect of Variables on the Likelihood of Reservation, with 95 percent CIs
* (Individual Components of Demanding Provisions)

eststo plot2: sem (reservation_5Y <- strong precise dom_action nonderog_prov $institutions $econ, vce(cluster country_treaty))
coefplot, drop(_cons) xline(0) xlabel(, nogrid) ylabel(, nogrid) b(b_std) v(V_std) xtitle(Standardized Coefficients)  level(95) 
graph export "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Figures/Figure A2.eps", replace



* Figure A3: Predicted Effect of Variables on the Likelihood of Reservation, with 95 percent CIs
* (Dichotomous Measure vs. Index of Demandingness)

eststo Main: sem (reservation_5Y <- $institutions $econ nonderog_prov demanding, vce(cluster country_treaty))
eststo Supplementary: sem (reservation_5Y <- $institutions $econ nonderog_prov demanding_index, vce(cluster country_treaty))
coefplot Main Supplementary, drop(_cons) xline(0) xlabel(, nogrid) ylabel(, nogrid) b(b_std) v(V_std) xtitle(Standardized Coefficients) level(95)
graph export "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Figures/Figure A3.eps", replace





***
* Difference in means
***


clear
import excel "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Data/diff_of_means zsm2020reserving.xlsx", sheet("Sheet1") firstrow


* Figure A1: Average Reservations by Obligation Type

graph bar (asis) Yes No, over(dimension, sort(order)) bar(1, color(gs0*3)) bar(2, color(gs0*.5)) /*
*/ytitle("Average Number of Reservations", size(small))/*
*/note("Obligation Type",  size(small) pos(6) nobexpand)  graphregion(margin(zero)) /*
*/caption("All differences are statistically significant at p<0.001",  size(vsmall) pos(7))  graphregion(margin(zero))
graph export "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Figures/Figure A1.eps", replace





***
* Crosstabs
***


clear
use "/Users/kelebogilezvobgo/Dropbox/Human Rights Treaty Reservations/_ISQ submission/ISQ_FINAL/Data/Treaty Obligations zsm2020reserving.dta", replace


* Table A4: Demanding Provisions

tab demanding


* Table A5: Strength and Domestic Action

tab strong dom_action


* Table A6: Precision and Domestic Action

tab precise dom_action


* Table A7: Strength and Precision

tab strong precise
